﻿using System.Web;

namespace Altairis.IisNetDiag {
    public class FormHandler : IHttpHandler {

        public bool IsReusable {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context) {
            context.Response.ContentType = "text/html";

            var html = Properties.Resources.FormPage;
            html = html.Replace("$version", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            html = html.Replace("$target", context.Request.UserHostAddress);
            html = html.Replace("$address", context.Request.Url.AbsolutePath);
            context.Response.Write(html);
        }

    }
}
